summaryrefslogtreecommitdiffstats
path: root/decode-qr-uri.py
diff options
context:
space:
mode:
authorStephen Shkardoon <ss23@ss23.geek.nz>2019-10-06 10:59:50 +0200
committerStephen Shkardoon <ss23@ss23.geek.nz>2019-10-06 10:59:50 +0200
commit2ede6519fad2ab15767632350e3c48d2a1903522 (patch)
tree96a4c8b19a2148c76a75a9395c0b763e75fe679f /decode-qr-uri.py
parentAdd generate-otp.py script (diff)
downloadentrust-identityguard-tools-2ede6519fad2ab15767632350e3c48d2a1903522.tar
entrust-identityguard-tools-2ede6519fad2ab15767632350e3c48d2a1903522.tar.gz
entrust-identityguard-tools-2ede6519fad2ab15767632350e3c48d2a1903522.tar.bz2
entrust-identityguard-tools-2ede6519fad2ab15767632350e3c48d2a1903522.tar.lz
entrust-identityguard-tools-2ede6519fad2ab15767632350e3c48d2a1903522.tar.xz
entrust-identityguard-tools-2ede6519fad2ab15767632350e3c48d2a1903522.tar.zst
entrust-identityguard-tools-2ede6519fad2ab15767632350e3c48d2a1903522.zip
Diffstat (limited to 'decode-qr-uri.py')
-rwxr-xr-xdecode-qr-uri.py14
1 files changed, 6 insertions, 8 deletions
diff --git a/decode-qr-uri.py b/decode-qr-uri.py
index f376e38..711ce5b 100755
--- a/decode-qr-uri.py
+++ b/decode-qr-uri.py
@@ -1,6 +1,4 @@
#!/bin/env python3
-import hashlib
-import hmac
import urllib.parse
from hashlib import pbkdf2_hmac
import base64
@@ -56,11 +54,11 @@ logging.debug("KDF Salt: 0x%s", kdfSalt.hex())
# Run PBKDF2 to obtain our AES key
key = pbkdf2_hmac(
- hash_name = 'sha256',
- password = args.Password[0].encode('utf-8'),
- salt = kdfSalt,
- iterations = 1000,
- dklen = 64
+ hash_name='sha256',
+ password=args.Password[0].encode('utf-8'),
+ salt=kdfSalt,
+ iterations=1000,
+ dklen=64
)
logging.debug("KDF Output: 0x%s", key.hex())
@@ -99,7 +97,7 @@ logging.debug("IV: 0x%s", iv.hex())
logging.debug("AES Key: 0x%s", aesKey.hex())
# custom unpad, as pycrytodome does not support pkcs5
-unpad = lambda s : s[0:-(s[-1])]
+unpad = lambda s: s[0:-(s[-1])]
cipher = AES.new(aesKey, mode=AES.MODE_CBC, iv=iv)
decrypted_data = unpad(cipher.decrypt(encdata))